<%@ page language="java"  pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta name="format-detection" content="telephone=no,email=no,adress=no">
<link href="<%=request.getContextPath()%>/css/global.css" type="text/css" rel="stylesheet" />
<link href="<%=request.getContextPath() %>/js/easyui/themes/metro/easyui.css" type="text/css" rel="stylesheet"/>
<link href="<%=request.getContextPath() %>/js/date/skin/WdatePicker.css" type="text/css" rel="stylesheet"/>
<link href="<%=request.getContextPath()%>/js/autocomplate/jquery.autocomplete.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=request.getContextPath() %>/js/jquery.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/global.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/easyui/easyui.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/date/WdatePicker.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/autocomplate/jquery.autocomplete.js"></script>
<script type="text/javascript">

$(function(){

	$('#merNo').autocomplete({
    	serviceUrl: '<%=request.getContextPath()%>/merchant_auto.html',
    	minChars:1,
    	paramName:'merNo',
    	transformResult: function(response) {
		　　return {
		　　　　suggestions: $.map($.parseJSON(response), function(dataItem) {
		　　　　　　return { value: dataItem.merNo, data: dataItem.merName};
		　　　　})
		　　};
		},
    	formatResult:function (suggestion, currentValue) {
    		return "[" + suggestion.value.replace(currentValue,"<strong>"+currentValue+"</strong>")+ "]" + suggestion.data;
    	}
	});

	$("#dataTable").datagrid({
		toolbar: '#dataSearch',
		fitColumns:true,
		striped: true, 
		singleSelect:false,
		pagination:true,
		rownumbers:true,
		SelectOnCheck:true,
		CheckOnSelect:true,
        onSelect: function(index,row){
        	var nos="";
        	var rows = $('#dataTable').datagrid('getSelections');
        	for(var i=0; i<rows.length; i++){
        		nos=nos+rows[i].ck+",";
        	}
			$("#keys").val(nos);
    	},
    	onUnselect: function(index,row){
        	var nos="";
        	var rows = $('#dataTable').datagrid('getSelections');
        	for(var i=0; i<rows.length; i++){
        		nos=nos+rows[i].ck+",";
        	}
			$("#keys").val(nos);
    	},
    	onSelectAll: function(rows){
        	var nos="";
        	for(var i=0; i<rows.length; i++){
        		nos=nos+rows[i].ck+",";
        	}
			$("#keys").val(nos);
    	},
    	onUnselectAll: function(rows){
			$("#keys").val("");
    	}
	});
	
	$('#dataTable').datagrid('getPager').pagination({
		total:<s:property value="pageInfo.pageRecord"/>,
		pageNumber:<s:property value="pageInfo.pageIndex"/>,
		pageSize:<s:property value="pageInfo.pageSize"/>,
		pageList: [20,50,100] ,
		onSelectPage:function(pageNumber,pageSize){  
			toPage(pageNumber,pageSize);
		},
		onRefresh:function(pageNumber,pageSize){  
			location.reload();
		}
	});
	
});

function audit(){
	if($("#keys").val()==""){
		$.MsgBox.Alert('提示', '请先选择一项');
		return ;
	}
	$.ajax
		({
	  url:"mb_saveverify.html",
	  cache: false,
	  async: false,
	  type: "POST",
	  data:"mbNos="+$("#keys").val()+"&mbState="+$("input[name='state']:checked").val()+"&mbRemark="+encodeURIComponent($("#remark").val()),
	  success: function(html){
	  	if(html=="succ"){
	  		location.reload();
	  	}
	  	else{
	  		$.MsgBox.Alert('提示', '操作失败,请联系管理员');
	  	}
	  }
	}); 
}
</script>
</head>
<body >
<div id="dataSearch" >    
<form id="sform" action="mb_listverify.html" method="get" enctype="multipart/form-data">
<table style="width: 100%;">
<tr>
<td height="25" >
	<b>操作说明:多个商户号可以用逗号隔开</b> 
</td>
</tr>
<tr><td height="30" >
<s:textfield  id="mbNo" name="mbNo" placeholder="流水号"></s:textfield>
<s:textfield  id="merNo" name="merNo" placeholder="商户编号"></s:textfield>
<s:select id="mbState" name="mbState" list="#{'1':'有效','0':'无效'}" headerKey="" headerValue="提现状态"/>

<s:textfield  id="mbDateTop"  name="mbDateTop" placeholder="发生日期起"  onclick="WdatePicker();"  cssStyle="width:100px;" ><s:param name="value"><s:date name="mbDateTop" format="yyyy-MM-dd"/></s:param></s:textfield>
 - 
<s:textfield  id="mbDateEnd"  name="mbDateEnd" placeholder="发生日期止"  onclick="WdatePicker();"  cssStyle="width:100px;" ><s:param name="value"><s:date name="mbDateEnd" format="yyyy-MM-dd"/></s:param></s:textfield>
<s:select id="mbVstate" name="mbVstate" list="#{'1':'有效','0':'无效'}" headerKey="" headerValue="审核状态"/>

<s:textfield  id="mbVdateTop"  name="mbVdateTop" placeholder="审核日期起"  onclick="WdatePicker();"  cssStyle="width:100px;" ><s:param name="value"><s:date name="mbVdateTop" format="yyyy-MM-dd"/></s:param></s:textfield>
 - 
<s:textfield  id="mbVdateEnd"  name="mbVdateEnd" placeholder="审核日期止"  onclick="WdatePicker();"  cssStyle="width:100px;" ><s:param name="value"><s:date name="mbVdateEnd" format="yyyy-MM-dd"/></s:param></s:textfield>

<input type="button" class="submit" value="查询搜索" onclick="sform.submit();"/></td>
</tr>
<tr><td><hr/></td></tr>
<tr>
<td height="30" >
	<input type="hidden"  id="keys" name="keys"  value=""/>
		<input type="button" class="submit"   value="导出数据"  onclick="if(confirm('确认要执行导出操作吗?')){window.open(location.href.replace('list','export'));}"/>
		&nbsp;&nbsp;&nbsp;&nbsp;
		<input type="button" class="submit" value="发生日期" onclick="toSort('sortField','mbDate')"/>
		<input type="button" class="submit" value="审核日期" onclick="toSort('sortField','mbVdate')"/>
		
		&nbsp;&nbsp;&nbsp;&nbsp;
		<input type="button" class="submit" value="升序排列" onclick="toSort('sortOrder','true')"/>
		<input type="button" class="submit" value="降序排列" onclick="toSort('sortOrder','false')"/>
</td>
</tr>
</table>
</form>
<table style="width: 100%;">
<tr>
<td height="30" >
		<input type="button" class="submit" value="批量审核" onclick="audit();"/>
		<s:radio id="state" name="state" list="#{'0':'拒绝','1':'通过'}" value="1"></s:radio>
		审核备注 : <input type="text"  id="remark"  style="width:360px;" />
</td>
</tr>
</table>
</div>

<table id="dataTable" style="width: 100%;" class="easyui-datagrid" >
<thead>
<tr>
<th data-options="field:'ck'" checkbox="true"></th>
<th data-options="field:'mbNo', width:'10%',align:'left' , halign: 'left'">流水号</th>
<th data-options="field:'merNo', width:'6%',align:'left' , halign: 'left'">商户编号</th>
<th data-options="field:'mbBank', width:'6%',align:'left' , halign: 'left'">结算银行名称</th>
<th data-options="field:'mbBranch', width:'8%',align:'left' , halign: 'left'">支行</th>
<th data-options="field:'mbBanker', width:'6%',align:'left' , halign: 'left'">账户名</th>
<th data-options="field:'mbAccount', width:'10%',align:'left' , halign: 'left'">银行帐号</th>
<th data-options="field:'mbAmount', width:'8%',align:'left' , halign: 'left'">金额</th>
<th data-options="field:'mbState', width:'5%',align:'left' , halign: 'left'">提现状态</th>
<th data-options="field:'mbDate', width:'10%',align:'left' , halign: 'left'">发生日期</th>
<th data-options="field:'mbVstate', width:'5%',align:'left' , halign: 'left'">审核状态</th>
<th data-options="field:'mbVdate', width:'10%',align:'left' , halign: 'left'">审核日期</th>
<th data-options="field:'mbRemar', width:'10%',align:'left' , halign: 'left'">备注</th>
<th data-options="field:'op', width:'100',align:'left' , halign: 'left'">操作</th>

</tr>
</thead>
<tbody>
<s:iterator value="mbList" id="show" status="seq">
<tr>
<td><s:property value="#show.mbNo"/></td>
<td><s:property value="#show.mbNo"/></td>
<td><s:property value="#show.merNo"/></td>
<td><s:property value="#show.mbBank"/></td>
<td><s:property value="#show.mbBranch"/></td>
<td><s:property value="#show.mbBanker"/></td>
<td><s:property value="#show.mbAccount"/></td>
<td><s:text name="global.format.number"><s:param value="#show.mbAmount"/></s:text></td>
<td><s:if test="#show.mbState==0"><img src="<%=request.getContextPath() %>/image/cancel.png"  /></s:if><s:else><img src="<%=request.getContextPath() %>/image/accept.png"  /></s:else></td>
<td><s:text name="global.format.dateminute"><s:param value="#show.mbDate"/></s:text>
<td><s:if test="#show.mbVstate==0"><img src="<%=request.getContextPath() %>/image/cancel.png"  /></s:if><s:else><img src="<%=request.getContextPath() %>/image/accept.png"  /></s:else></td>
<td><s:text name="global.format.dateminute"><s:param value="#show.mbVdate"/></s:text>
<td><s:property value="#show.mbRemark"/></td>
<td>
<input type="button" value="打印" style="width: 50px;" class="submit" onclick="window.open('<%=request.getContextPath()%>/mb_page.html?mbNo=<s:property value="#show.mbNo"/>')"/>
</td>
</tr>
</s:iterator>
</tbody>
</table>
<br/>
<br/>
<br/>
</body>
</html>
